package org.apache.dubbo.springboot.demo.consumer;

import java.util.HashMap;
import java.util.Map;

public class EnvUtils {

    public static final Map<String, String> DUBBO_ENV = getEnvInfo();
    public static final String RUNTIME_ENV = "ENV";

    private static Map<String, String> getEnvInfo() {
        Map<String, String> envMap = new HashMap<>(16);
        String dubboEnvKeys = System.getenv("DUBBO_ENV_KEYS");
        if (dubboEnvKeys != null) {
            String[] keys = dubboEnvKeys.split(",");
            for (String key : keys) {
                String value = System.getenv(key.trim());
                envMap.put(key, value);
            }
        }
        return envMap;
    }
}
